import React from 'react'
import { withRouter, NavLink } from 'react-router-dom'
import { observer, inject } from 'mobx-react'
import unit from '../hml'
import Main from './Main'
import Footer from './Footer'
@withRouter //更新数据
@inject('four') //获取数据
@observer //让页面变成响应式
class Top extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            sss: {
                page_number: 1, page_size: 15
            }
        }
    }
    componentDidMount() {
        const { setDatas, data } = this.props.four
        const { sss } = this.state
        unit.getApi2('/home/mediareports', sss).then((res) => {
            setDatas(res.data.data)
            console.log(res.data.data)
        })
    }
    change() {
        const { setData, data } = this.props.four
        // setData(index, e.target.value)
        console.log(data)
    }
    render() {
        const { data } = this.props.four
        return <div>
            <ul>
                {
                    data.map((item, index) => {
                        return <li key={index}>
                            {item.source}
                            <input type="text" value={item.source} onChange={(e) => this.change(index)} />
                        </li>
                    })
                }
            </ul>
            <Main></Main>
            <Footer></Footer>
        </div>
    }
}
export default Top

